public class Solution657 {
    public boolean judgeCircle(String moves) {
        int a=0,b=0;
        for (char c : moves.toCharArray()) {
            switch (c){
                case 'L':
                    a++;
                    break;
                case 'R':
                    a--;
                    break;
                case 'U':
                    b++;
                    break;
                case 'D':
                    b--;
                    break;
            }
        }
        return a==0 && b==0;
    }

    public static void main(String[] args) {
        System.out.println(new Solution657().judgeCircle("UD"));
    }
}
